#ifndef ZLDEVICE_CDEVICEMANAGER_H_
#define ZLDEVICE_CDEVICEMANAGER_H_

#include <map>
#include <memory>

#include "util/config.h"
#include "zlbase/zlbase.h"

class CDeviceManager
{
public:
    static CDeviceManager& Instance();

    bool LoadZlBaseConfiguration(const std::string& path = ZLBaseConfigFile);

    bool SaveZlBaseConfiguration(const std::string& path = ZLBaseConfigFile);

    int32_t GetBoxCount();

    std::vector<CZlBaseConfig::ZLBaseDevice> GetDevicesConfig();

    std::map<int32_t, std::shared_ptr<zl::zlbase::IDoorControlBoard>> GetDoorControlBoardList();

    std::shared_ptr<zl::zlbase::IMonitorControlBoard> GetMonitorControlBoard();

    void ReleaseAllDevices();

private:
    CDeviceManager() = default;
    ~CDeviceManager() = default;

    CZlBaseConfig config_;
    std::shared_ptr<zl::zlbase::IMonitorControlBoard> monitor_;
    std::map<int32_t, std::shared_ptr<zl::zlbase::IDoorControlBoard>> dcb_list_;
};

#endif  // ZLDEVICE_CDEVICEMANAGER_H_